const http=require('http');
const path=require('path');
const fs=require('fs');
const zlib=require('zlib');

const server=http.createServer((req, res)=>{
	let rs=fs.createReadStream(`./www${req.url}`);
	let gz=zlib.createGzip();
	res.setHeader('Content-Encoding', 'gzip');
	rs.pipe(gz).pipe(res);
	rs.on('error', err=>{
		console.log(err);
	});
});
server.listen(4000, ()=>{
	console.log('running at 4000');
});